<?php if ( ! defined('BASEPATH')) exit('No se permite acceso directo al script');

class To_excel {
	function getExcelObject($titulo = '')
	{
		require_once 'application/phpexcel/PHPExcel.php';

		// Crea un nuevo objeto PHPExcel
		$objPHPExcel = new PHPExcel();

		// Establecer propiedades básicas del Excel
		$objPHPExcel->getProperties()
		->setTitle($titulo)
		->setSubject($titulo)
		->setCreator("Inalta")
		->setLastModifiedBy("Inalta")
		->setDescription($titulo)
		->setKeywords("Excel Office 2007");
		
		$styleArray = array(
			'font' => array(
				'name' => 'Calibri', 
				'size' => 11
			),
			'alignment' => array(
				'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
				'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
			)
		);
		// Defino estilos del cuerpo en general del documento
		$objPHPExcel->getDefaultStyle()->applyFromArray($styleArray);

		return $objPHPExcel;	
	}

	function getHeadersStyle()
	{
		$styleArray = array(
				'font' => array(
					'bold' => true,
					'name' => 'Calibri', 
					'size' => 12
				),
				'alignment' => array(
					'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
					'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
				),
				'borders' => array(
					'top' => array(
						'style' => PHPExcel_Style_Border::BORDER_THIN,
					),
					'bottom' => array(
						'style' => PHPExcel_Style_Border::BORDER_THIN,
					),
				)
			);

		return $styleArray;
	}

	function getTitleStyle()
	{
		$styleArray = array(
			'font' => array(
				'bold' => true,
				'name' => 'Calibri', 
				'size' => 20
			),
			'alignment' => array(
				'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
				'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
			)
		);

		return $styleArray;
	}

	function getExcelDrawing()
	{
		return new PHPExcel_Worksheet_Drawing();
	}
}
/* Fin del archivo */